﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HarveyNash.RefactoringAndCodeSmell.Refactoring.DecomposeConditional
{
    class Before
    {
        private readonly double DISCOUNT_PERCENTAGE = 0.05; //5%
        private readonly double VAT = 0.10; //10%

        public double CalculateTotalPayment(string code, float quantity, float unitPrice)
        {
            if (code.StartsWith("LCD") || code.StartsWith("KB") || code.StartsWith("HDD") || code.StartsWith("CPU"))
                return quantity * unitPrice * (1 + VAT - DISCOUNT_PERCENTAGE);
            else
                return quantity * unitPrice * (1 + VAT);
        }
    }
}
